package com.junyidao.game.controller;

import com.junyidao.game.pojo.SysUser;
import com.junyidao.game.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.Map;

/**
 * Created by zzh on 2016/6/30.
 */
@Controller
@RequestMapping("/register")
public class RegisterController extends BaseController {

    @Autowired
    private UserService userService;

    @RequestMapping
    public ModelAndView register() {
        ModelAndView result = new ModelAndView("register");
        return result;
    }

    @ResponseBody
    @RequestMapping(value = "/addRegister")
    public Map<String, Object> addRegister(SysUser user) {
        userService.addSysUser(user);
        return resultSucess(null);
    }

    @RequestMapping(value = "/list")
    public ModelAndView list() {
        ModelAndView result = new ModelAndView("system/register");
        return result;
    }
}
